package com.javasm.mingming.adminuser.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.javasm.mingming.adminuser.service.AdminRoleService;
import com.javasm.mingming.adminuser.dao.AdminRoleDao;
import com.javasm.mingming.adminuser.entity.AdminMenu;
import com.javasm.mingming.adminuser.entity.AdminRole;
import com.javasm.mingming.adminuser.service.AdminMenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (AdminRole)表服务实现类
 *
 * @author makejava
 * @since 2025-01-15 09:52:44
 */
@Service("adminRoleService")
public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleDao, AdminRole> implements AdminRoleService {

    @Resource
    AdminMenuService adminMenuService;

    @Override
    public AdminRole getByRid(Long roleId) {
        AdminRole adminRole = getById(roleId);
        if(adminRole != null){
            //根据角色id 查询 菜单列表
            List<AdminMenu> menuList = adminMenuService.listByRid(roleId);
            adminRole.setMenuList(menuList);
        }
        return adminRole;
    }
}

